<template>
  <div class="app-container">
    <el-form :model="queryParams" ref="queryForm" size="small" :inline="true" v-show="showSearch" label-width="68px">
      <el-form-item label="辅导员姓名" prop="stuCounselorName">
        <el-input v-model="queryParams.stuCounselorName" placeholder="请输入辅导员姓名" clearable
          @keyup.enter.native="handleQuery" />
      </el-form-item>
      <el-form-item label="专业名称" prop="stuMajor">
        <el-select v-model="queryParams.stuMajor" placeholder="请选择专业名称" clearable>
          <el-option v-for="dict in dict.type.major" :key="dict.value" :label="dict.label" :value="dict.value" />
        </el-select>
      </el-form-item>
      <el-form-item label="班级" prop="stuClass">
        <el-input v-model="queryParams.stuClass" placeholder="请输入班级" clearable @keyup.enter.native="handleQuery" />
      </el-form-item>
      <el-form-item label="班级内序号" prop="stuClassId">
        <el-input v-model="queryParams.stuClassId" placeholder="请输入班级内序号" clearable @keyup.enter.native="handleQuery" />
      </el-form-item>
      <el-form-item label="学号" prop="stuSno">
        <el-input v-model="queryParams.stuSno" placeholder="请输入学号" clearable @keyup.enter.native="handleQuery" />
      </el-form-item>
      <el-form-item label="姓名" prop="stuName">
        <el-input v-model="queryParams.stuName" placeholder="请输入姓名" clearable @keyup.enter.native="handleQuery" />
      </el-form-item>
      <el-form-item label="性别" prop="stuSex">
        <el-select v-model="queryParams.stuSex" placeholder="请选择性别" clearable>
          <el-option v-for="dict in dict.type.sys_user_sex" :key="dict.value" :label="dict.label" :value="dict.value" />
        </el-select>
      </el-form-item>
      <el-form-item label="民族" prop="stuNation">
        <el-select v-model="queryParams.stuNation" placeholder="请选择民族" clearable>
          <el-option v-for="dict in dict.type.nation" :key="dict.value" :label="dict.label" :value="dict.value" />
        </el-select>
      </el-form-item>
      <el-form-item label="出生日期" prop="stuBirth">
        <el-date-picker clearable v-model="queryParams.stuBirth" type="date" value-format="yyyy-MM-dd"
          placeholder="请选择出生日期">
        </el-date-picker>
      </el-form-item>
      <el-form-item label="政治面貌" prop="stuPartyType">
        <el-select v-model="queryParams.stuPartyType" placeholder="请选择政治面貌" clearable>
          <el-option v-for="dict in dict.type.party_type" :key="dict.value" :label="dict.label" :value="dict.value" />
        </el-select>
      </el-form-item>
      <el-form-item label="宿舍" prop="stuDormitory">
        <el-input v-model="queryParams.stuDormitory" placeholder="请输入宿舍" clearable @keyup.enter.native="handleQuery" />
      </el-form-item>
      <el-form-item label="籍贯" prop="stuPlaceOfOrigin">
        <el-input v-model="queryParams.stuPlaceOfOrigin" placeholder="请输入籍贯" clearable
          @keyup.enter.native="handleQuery" />
      </el-form-item>
      <el-form-item label="生源地" prop="stuBirthplaceOfBirth">
        <el-input v-model="queryParams.stuBirthplaceOfBirth" placeholder="请输入生源地" clearable
          @keyup.enter.native="handleQuery" />
      </el-form-item>
      <el-form-item label="家庭详细住址" prop="stuHomeAddress">
        <el-input v-model="queryParams.stuHomeAddress" placeholder="请输入家庭详细住址" clearable
          @keyup.enter.native="handleQuery" />
      </el-form-item>
      <el-form-item label="上一学历毕业院校" prop="stuPreviousInstitution">
        <el-input v-model="queryParams.stuPreviousInstitution" placeholder="请输入上一学历毕业院校" clearable
          @keyup.enter.native="handleQuery" />
      </el-form-item>
      <el-form-item label="个人电话" prop="stuTelephone">
        <el-input v-model="queryParams.stuTelephone" placeholder="请输入个人电话" clearable
          @keyup.enter.native="handleQuery" />
      </el-form-item>
      <el-form-item label="家庭电话" prop="stuHomeTelephone">
        <el-input v-model="queryParams.stuHomeTelephone" placeholder="请输入家庭电话" clearable
          @keyup.enter.native="handleQuery" />
      </el-form-item>
      <el-form-item label="QQ号" prop="stuQq">
        <el-input v-model="queryParams.stuQq" placeholder="请输入QQ号" clearable @keyup.enter.native="handleQuery" />
      </el-form-item>
      <el-form-item label="微信号" prop="stuWx">
        <el-input v-model="queryParams.stuWx" placeholder="请输入微信号" clearable @keyup.enter.native="handleQuery" />
      </el-form-item>
      <el-form-item label="电子邮箱号" prop="stuEmail">
        <el-input v-model="queryParams.stuEmail" placeholder="请输入电子邮箱号" clearable @keyup.enter.native="handleQuery" />
      </el-form-item>
      <el-form-item label="宗教信仰" prop="stuBelief">
        <el-input v-model="queryParams.stuBelief" placeholder="请输入宗教信仰" clearable @keyup.enter.native="handleQuery" />
      </el-form-item>
      <el-form-item label="学生职务" prop="stuRole">
        <el-input v-model="queryParams.stuRole" placeholder="请输入学生职务" clearable @keyup.enter.native="handleQuery" />
      </el-form-item>
      <el-form-item label="学生学历" prop="stuDegreeLevel">
        <el-select v-model="queryParams.stuDegreeLevel" placeholder="请选择学生学历" clearable>
          <el-option v-for="dict in dict.type.degree_level" :key="dict.value" :label="dict.label" :value="dict.value" />
        </el-select>
      </el-form-item>
      <el-form-item label="辅导员序号" prop="userId">
        <el-input v-model="queryParams.userId" placeholder="请输入辅导员序号" clearable @keyup.enter.native="handleQuery" />
      </el-form-item>
      <el-form-item label="部门id" prop="deptId">
        <el-input v-model="queryParams.deptId" placeholder="请输入部门id" clearable @keyup.enter.native="handleQuery" />
      </el-form-item>
      <el-form-item label="审核状态" prop="auditStatus">
        <el-select v-model="queryParams.auditStatus" placeholder="请选择审核状态" clearable>
          <el-option v-for="dict in dict.type.audit_status" :key="dict.value" :label="dict.label" :value="dict.value" />
        </el-select>
      </el-form-item>
      <el-form-item label="未通过原因" prop="rejectionReason">
        <el-input v-model="queryParams.rejectionReason" placeholder="请输入未通过原因" clearable
          @keyup.enter.native="handleQuery" />
      </el-form-item>
      <el-form-item>
        <el-button type="primary" icon="el-icon-search" size="mini" @click="handleQuery">搜索</el-button>
        <el-button icon="el-icon-refresh" size="mini" @click="resetQuery">重置</el-button>
      </el-form-item>
    </el-form>

    <el-row :gutter="10" class="mb8">
      <el-col :span="1.5">
        <el-button type="primary" plain icon="el-icon-plus" size="mini" @click="handleAdd"
          v-hasPermi="['students:students:add']">新增</el-button>
      </el-col>
      <el-col :span="1.5">
        <el-button type="success" plain icon="el-icon-edit" size="mini" :disabled="single" @click="handleUpdate"
          v-hasPermi="['students:students:edit']">修改</el-button>
      </el-col>
      <el-col :span="1.5">
        <el-button type="danger" plain icon="el-icon-delete" size="mini" :disabled="multiple" @click="handleDelete"
          v-hasPermi="['students:students:remove']">删除</el-button>
      </el-col>
      <!-- 审核   -->
      <el-col :span="1.5">
        <el-button type="info" icon="el-icon-check" size="mini" @click="openAuditDialog" :disabled="multiple"
          v-hasPermi="['system:check']" plain>审核</el-button>
      </el-col>
      <el-col :span="1.5">
        <el-button type="warning" plain icon="el-icon-download" size="mini" @click="handleExport"
          v-hasPermi="['students:students:export']">导出</el-button>
      </el-col>
      <right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
    </el-row>
    <!-- 确保visible是通过sync双向绑定 -->
    <!-- 审核   -->
    <audit-dialog :visible.sync="auditDialogVisible" table_name="xg_students" id_name="id" ref="audit"
      @submit="handleAuditSubmit" />
    <el-table v-loading="loading" :data="studentsList" @selection-change="handleSelectionChange">
      <el-table-column type="selection" width="55" align="center" />
      <el-table-column label="序号" align="center" prop="id" />
      <el-table-column label="辅导员姓名" align="center" prop="stuCounselorName" />
      <el-table-column label="专业名称" align="center" prop="stuMajor">
        <template slot-scope="scope">
          <dict-tag :options="dict.type.major" :value="scope.row.stuMajor" />
        </template>
      </el-table-column>
      <el-table-column label="班级" align="center" prop="stuClass" />
      <el-table-column label="班级内序号" align="center" prop="stuClassId" />
      <el-table-column label="学号" align="center" prop="stuSno" />
      <el-table-column label="姓名" align="center" prop="stuName" />
      <el-table-column label="性别" align="center" prop="stuSex">
        <template slot-scope="scope">
          <dict-tag :options="dict.type.sys_user_sex" :value="scope.row.stuSex" />
        </template>
      </el-table-column>
      <el-table-column label="民族" align="center" prop="stuNation">
        <template slot-scope="scope">
          <dict-tag :options="dict.type.nation" :value="scope.row.stuNation" />
        </template>
      </el-table-column>
      <el-table-column label="出生日期" align="center" prop="stuBirth" width="180">
        <template slot-scope="scope">
          <span>{{ parseTime(scope.row.stuBirth, '{y}-{m}-{d}') }}</span>
        </template>
      </el-table-column>
      <el-table-column label="政治面貌" align="center" prop="stuPartyType">
        <template slot-scope="scope">
          <dict-tag :options="dict.type.party_type" :value="scope.row.stuPartyType" />
        </template>
      </el-table-column>
      <el-table-column label="宿舍" align="center" prop="stuDormitory" />
      <el-table-column label="籍贯" align="center" prop="stuPlaceOfOrigin" />
      <el-table-column label="生源地" align="center" prop="stuBirthplaceOfBirth" />
      <el-table-column label="家庭详细住址" align="center" prop="stuHomeAddress" />
      <el-table-column label="上一学历毕业院校" align="center" prop="stuPreviousInstitution" />
      <el-table-column label="个人电话" align="center" prop="stuTelephone" />
      <el-table-column label="家庭电话" align="center" prop="stuHomeTelephone" />
      <el-table-column label="QQ号" align="center" prop="stuQq" />
      <el-table-column label="微信号" align="center" prop="stuWx" />
      <el-table-column label="电子邮箱号" align="center" prop="stuEmail" />
      <el-table-column label="宗教信仰" align="center" prop="stuBelief" />
      <el-table-column label="学生职务" align="center" prop="stuRole" />
      <el-table-column label="学生学历" align="center" prop="stuDegreeLevel">
        <template slot-scope="scope">
          <dict-tag :options="dict.type.degree_level" :value="scope.row.stuDegreeLevel" />
        </template>
      </el-table-column>
      <el-table-column label="辅导员序号" align="center" prop="userId" />
      <el-table-column label="部门id" align="center" prop="deptId" />
      <el-table-column label="审核状态" align="center" prop="auditStatus">
        <template slot-scope="scope">
          <dict-tag :options="dict.type.audit_status" :value="scope.row.auditStatus" />
        </template>
      </el-table-column>
      <el-table-column label="未通过原因" align="center" prop="rejectionReason" />
      <el-table-column label="操作" align="center" class-name="small-padding fixed-width">
        <template slot-scope="scope">
          <el-button size="mini" type="text" icon="el-icon-edit" @click="handleUpdate(scope.row)"
            v-hasPermi="['students:students:edit']">修改</el-button>
          <el-button size="mini" type="text" icon="el-icon-delete" @click="handleDelete(scope.row)"
            v-hasPermi="['students:students:remove']">删除</el-button>
        </template>
      </el-table-column>
    </el-table>

    <pagination v-show="total > 0" :total="total" :page.sync="queryParams.pageNum" :limit.sync="queryParams.pageSize"
      @pagination="getList" />

    <!-- 添加或修改学生基本信息对话框 -->
    <el-dialog :title="title" :visible.sync="open" width="500px" append-to-body>
      <el-form ref="form" :model="form" :rules="rules" label-width="80px">
        <el-form-item label="辅导员姓名" prop="stuCounselorName">
          <el-input v-model="form.stuCounselorName" placeholder="请输入辅导员姓名" />
        </el-form-item>
        <el-form-item label="专业名称" prop="stuMajor">
          <el-select v-model="form.stuMajor" placeholder="请选择专业名称">
            <el-option v-for="dict in dict.type.major" :key="dict.value" :label="dict.label"
              :value="dict.value"></el-option>
          </el-select>
        </el-form-item>
        <el-form-item label="班级" prop="stuClass">
          <el-input v-model="form.stuClass" placeholder="请输入班级" />
        </el-form-item>
        <el-form-item label="班级内序号" prop="stuClassId">
          <el-input v-model="form.stuClassId" placeholder="请输入班级内序号" />
        </el-form-item>
        <el-form-item label="学号" prop="stuSno">
          <el-input v-model="form.stuSno" placeholder="请输入学号" />
        </el-form-item>
        <el-form-item label="姓名" prop="stuName">
          <el-input v-model="form.stuName" placeholder="请输入姓名" />
        </el-form-item>
        <el-form-item label="性别" prop="stuSex">
          <el-select v-model="form.stuSex" placeholder="请选择性别">
            <el-option v-for="dict in dict.type.sys_user_sex" :key="dict.value" :label="dict.label"
              :value="dict.value"></el-option>
          </el-select>
        </el-form-item>
        <el-form-item label="民族" prop="stuNation">
          <el-select v-model="form.stuNation" placeholder="请选择民族">
            <el-option v-for="dict in dict.type.nation" :key="dict.value" :label="dict.label"
              :value="dict.value"></el-option>
          </el-select>
        </el-form-item>
        <el-form-item label="出生日期" prop="stuBirth">
          <el-date-picker clearable v-model="form.stuBirth" type="date" value-format="yyyy-MM-dd" placeholder="请选择出生日期">
          </el-date-picker>
        </el-form-item>
        <el-form-item label="政治面貌" prop="stuPartyType">
          <el-select v-model="form.stuPartyType" placeholder="请选择政治面貌">
            <el-option v-for="dict in dict.type.party_type" :key="dict.value" :label="dict.label"
              :value="dict.value"></el-option>
          </el-select>
        </el-form-item>
        <el-form-item label="宿舍" prop="stuDormitory">
          <el-input v-model="form.stuDormitory" placeholder="请输入宿舍" />
        </el-form-item>
        <el-form-item label="籍贯" prop="stuPlaceOfOrigin">
          <el-input v-model="form.stuPlaceOfOrigin" placeholder="请输入籍贯" />
        </el-form-item>
        <el-form-item label="生源地" prop="stuBirthplaceOfBirth">
          <el-input v-model="form.stuBirthplaceOfBirth" placeholder="请输入生源地" />
        </el-form-item>
        <el-form-item label="家庭详细住址" prop="stuHomeAddress">
          <el-input v-model="form.stuHomeAddress" placeholder="请输入家庭详细住址" />
        </el-form-item>
        <el-form-item label="上一学历毕业院校" prop="stuPreviousInstitution">
          <el-input v-model="form.stuPreviousInstitution" placeholder="请输入上一学历毕业院校" />
        </el-form-item>
        <el-form-item label="个人电话" prop="stuTelephone">
          <el-input v-model="form.stuTelephone" placeholder="请输入个人电话" />
        </el-form-item>
        <el-form-item label="家庭电话" prop="stuHomeTelephone">
          <el-input v-model="form.stuHomeTelephone" placeholder="请输入家庭电话" />
        </el-form-item>
        <el-form-item label="QQ号" prop="stuQq">
          <el-input v-model="form.stuQq" placeholder="请输入QQ号" />
        </el-form-item>
        <el-form-item label="微信号" prop="stuWx">
          <el-input v-model="form.stuWx" placeholder="请输入微信号" />
        </el-form-item>
        <el-form-item label="电子邮箱号" prop="stuEmail">
          <el-input v-model="form.stuEmail" placeholder="请输入电子邮箱号" />
        </el-form-item>
        <el-form-item label="宗教信仰" prop="stuBelief">
          <el-input v-model="form.stuBelief" placeholder="请输入宗教信仰" />
        </el-form-item>
        <el-form-item label="学生职务" prop="stuRole">
          <el-input v-model="form.stuRole" placeholder="请输入学生职务" />
        </el-form-item>
        <el-form-item label="学生学历" prop="stuDegreeLevel">
          <el-select v-model="form.stuDegreeLevel" placeholder="请选择学生学历">
            <el-option v-for="dict in dict.type.degree_level" :key="dict.value" :label="dict.label"
              :value="dict.value"></el-option>
          </el-select>
        </el-form-item>
        <el-form-item label="辅导员序号" prop="userId">
          <el-input v-model="form.userId" placeholder="请输入辅导员序号" />
        </el-form-item>
        <el-form-item label="部门id" prop="deptId">
          <el-input v-model="form.deptId" placeholder="请输入部门id" />
        </el-form-item>
        <el-form-item label="审核状态" prop="auditStatus">
          <el-select v-model="form.auditStatus" placeholder="请选择审核状态">
            <el-option v-for="dict in dict.type.audit_status" :key="dict.value" :label="dict.label"
              :value="dict.value"></el-option>
          </el-select>
        </el-form-item>
        <el-form-item label="未通过原因" prop="rejectionReason">
          <el-input v-model="form.rejectionReason" placeholder="请输入未通过原因" />
        </el-form-item>
      </el-form>
      <div slot="footer" class="dialog-footer">
        <el-button type="primary" @click="submitForm">确 定</el-button>
        <el-button @click="cancel">取 消</el-button>
      </div>
    </el-dialog>
  </div>
</template>

<script>
import { listStudents, getStudents, delStudents, addStudents, updateStudents } from "@/api/students/students";
import AuditDialog from '@/components/AuditDialog/AuditDialog.vue' // 引入审核子组件

export default {
  name: "Students",
  dicts: ['party_type', 'degree_level', 'major', 'audit_status', 'sys_user_sex', 'nation'],
  components: { AuditDialog },
  data() {
    return {
      // 控制审核对话框的显示
      auditDialogVisible: false,
      // 遮罩层
      loading: true,
      // 选中数组
      ids: [],
      // 非单个禁用
      single: true,
      // 非多个禁用
      multiple: true,
      // 显示搜索条件
      showSearch: true,
      // 总条数
      total: 0,
      // 学生基本信息表格数据
      studentsList: [],
      // 弹出层标题
      title: "",
      // 是否显示弹出层
      open: false,
      // 查询参数
      queryParams: {
        pageNum: 1,
        pageSize: 10,
        stuCounselorName: null,
        stuMajor: null,
        stuClass: null,
        stuClassId: null,
        stuSno: null,
        stuName: null,
        stuSex: null,
        stuNation: null,
        stuBirth: null,
        stuPartyType: null,
        stuDormitory: null,
        stuPlaceOfOrigin: null,
        stuBirthplaceOfBirth: null,
        stuHomeAddress: null,
        stuPreviousInstitution: null,
        stuTelephone: null,
        stuHomeTelephone: null,
        stuQq: null,
        stuWx: null,
        stuEmail: null,
        stuBelief: null,
        stuRole: null,
        stuDegreeLevel: null,
        userId: null,
        deptId: null,
        auditStatus: null,
        rejectionReason: null
      },
      // 表单参数
      form: {},
      // 表单校验
      rules: {
        stuCounselorName: [
          { required: true, message: "辅导员姓名不能为空", trigger: "blur" },
          { pattern: /^[\u4e00-\u9fa5]{2,8}$/, message: "辅导员姓名格式必须是2到8个汉字", trigger: "blur" }
        ],
        stuMajor: [
          { required: true, message: "专业不能为空", trigger: "change" }
        ],
        stuClass: [
          { required: true, message: "班级不能为空", trigger: "blur" },
          { pattern: /^(电化|电气|物联|计科|软件|智能|微机|硕电信|博电信)\d{4}$/, message: "班级格式不正确，必须以“电化/电气/物联/计科/软件/智能/微机/硕电信/博电信”中一个开头，后面跟四位数字", trigger: "blur" }
        ],
        stuDormitory: [
          { required: true, message: "宿舍不能为空", trigger: "blur" },
          { pattern: /^N\d-\d{3}$/, message: "宿舍格式不正确，格式应类似于B4-215", trigger: "blur" }
        ],
        stuSno: [
          {
            required: true,
            message: '学号不能为空',
            trigger: 'blur'
          },
          {
            pattern: /^[ABS]\d{8}$/, // 学号格式: A或B或S开头，后面跟8位数字
            message: '学号格式不正确，必须以A、B或S开头，后面跟8位数字',
            trigger: 'blur'
          }
        ],
        stuName: [
          { required: true, message: "姓名不能为空", trigger: "blur" },
          { pattern: /^[\u4e00-\u9fa5]{2,8}$/, message: "姓名格式不正确，必须是2到8个汉字", trigger: "blur" }
        ],

        stuTelephone: [
          { trigger: "blur", pattern: /^\d{11}$/, message: "个人电话格式不正确，应为11位数字" }
        ],
        stuHomeTelephone: [
          { trigger: "blur", pattern: /^\d{11}$/, message: "家庭电话格式不正确，应为11位数字" }
        ],
        stuQq: [
          { trigger: "blur", pattern: /^\d{10}$/, message: "QQ号格式不正确，应为10位数字" }
        ],
        stuEmail: [
          { trigger: "blur", pattern: /^[a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,}$/, message: "电子邮箱格式不正确" }
        ]
      },
    };
  },
  created() {
    this.getList();
  },
  methods: {
    // 打开审核对话框
    openAuditDialog() {
      if (this.ids != null) {
        this.auditDialogVisible = true // 显示审核对话框
        this.$refs['audit'].setData(this.ids)
      } else this.$message.error('请选择要审核的信息')
    },
    // 提交审核数据
    async handleAuditSubmit() {
      this.auditDialogVisible = false // 关闭审核对话框
      await this.getList() // 刷新数据列表
    },
    /** 查询学生基本信息列表 */
    getList() {
      this.loading = true;
      listStudents(this.queryParams).then(response => {
        this.studentsList = response.rows;
        this.total = response.total;
        this.loading = false;
      });
    },
    // 取消按钮
    cancel() {
      this.open = false;
      this.reset();
    },
    // 表单重置
    reset() {
      this.form = {
        id: null,
        stuCounselorName: null,
        stuMajor: null,
        stuClass: null,
        stuClassId: null,
        stuSno: null,
        stuName: null,
        stuSex: null,
        stuNation: null,
        stuBirth: null,
        stuPartyType: null,
        stuDormitory: null,
        stuPlaceOfOrigin: null,
        stuBirthplaceOfBirth: null,
        stuHomeAddress: null,
        stuPreviousInstitution: null,
        stuTelephone: null,
        stuHomeTelephone: null,
        stuQq: null,
        stuWx: null,
        stuEmail: null,
        stuBelief: null,
        stuRole: null,
        stuDegreeLevel: null,
        userId: null,
        deptId: null,
        updateTime: null,
        auditStatus: null,
        rejectionReason: null
      };
      this.resetForm("form");
    },
    /** 搜索按钮操作 */
    handleQuery() {
      this.queryParams.pageNum = 1;
      this.getList();
    },
    /** 重置按钮操作 */
    resetQuery() {
      this.resetForm("queryForm");
      this.handleQuery();
    },
    // 多选框选中数据
    handleSelectionChange(selection) {
      this.ids = selection.map(item => item.id)
      this.single = selection.length !== 1
      this.multiple = !selection.length
    },
    /** 新增按钮操作 */
    handleAdd() {
      this.reset();
      this.open = true;
      this.title = "添加学生基本信息";
    },
    /** 修改按钮操作 */
    handleUpdate(row) {
      this.reset();
      const id = row.id || this.ids
      getStudents(id).then(response => {
        this.form = response.data;
        this.open = true;
        this.title = "修改学生基本信息";
      });
    },
    /** 提交按钮 */
    /** 提交按钮 */
    submitForm() {
      this.$refs["form"].validate(valid => {
        if (valid) {
          if (this.form.id != null) {
            updateStudents(this.form).then(response => {
              this.$modal.msgSuccess("修改成功");
              this.open = false;
              this.getList();
            });
          } else {
            addStudents(this.form).then(response => {
              this.$modal.msgSuccess("新增成功");
              this.open = false;
              this.getList();
            });
          }
        }
      });
    },

    /** 删除按钮操作 */
    handleDelete(row) {
      const ids = row.id || this.ids;
      this.$modal.confirm('是否确认删除学生基本信息编号为"' + ids + '"的数据项？').then(function () {
        return delStudents(ids);
      }).then(() => {
        this.getList();
        this.$modal.msgSuccess("删除成功");
      }).catch(() => { });
    },
    /** 导出按钮操作 */
    handleExport() {
      this.download('students/students/export', {
        ...this.queryParams
      }, `students_${new Date().getTime()}.xlsx`)
    }
  }
};
</script>
